package com.base.cn.platform.os.service.course.classes.topic;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.course.CourseBaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 班级话题
 *
 * @author SK
 * @since 2018-05-18
 */
@FeignClient(value = CourseBaseService.appName, configuration = FeignAuthConfig.class)
public interface ClassesTopicService extends CourseBaseService {

    /**
     * 班级话题分类统计数量
     *
     * @param classesId 班级id
     * @param userId    前台用户id
     * @return 班级话题分类统计数量
     */
    @RequestMapping(contextPath + "/classesTopicStatistics")
    Map<String, Object> classesTopicStatistics(@RequestParam(value = "classesId", required = false) BigDecimal classesId,
                                               @RequestParam(value = "userId", required = false) BigDecimal userId);

    /**
     * 根据id查询班级话题
     *
     * @param id               班级话题id
     * @param setCreator       设置创建人
     * @param setClasses       设置班级
     * @param setTopicType     设置话题类型
     * @param updateStatistics 更新话题统计数据
     * @return 班级话题
     */
    @RequestMapping(contextPath + "/findClassesTopicById")
    Map<String, Object> findClassesTopicById(@RequestParam("id") BigDecimal id,
                                             @RequestParam("setCreator") boolean setCreator,
                                             @RequestParam("setClasses") boolean setClasses,
                                             @RequestParam("setTopicType") boolean setTopicType,
                                             @RequestParam("updateStatistics") boolean updateStatistics);

    /**
     * 根据id查询班级话题
     *
     * @param ids          班级话题id
     * @param setSubject   设置专业
     * @param setCreator   设置创建人
     * @param setTopicType 设置话题类型
     * @return 试卷 key:班级话题id value:班级话题
     */
    @RequestMapping(contextPath + "/findClassesTopicByIds")
    Map<BigDecimal, Map<String, Object>> findClassesTopicByIds(@RequestParam("ids") String ids,
                                                               @RequestParam("setSubject") boolean setSubject,
                                                               @RequestParam("setCreator") boolean setCreator,
                                                               @RequestParam("setTopicType") boolean setTopicType);

    /**
     * 查询班级话题列表
     *
     * @param classesTopic 班级话题查询条件
     * @param count        数量
     * @param order        排序 1.最新 2.最热
     * @param setCreator   设置创建人
     * @param setClasses   设置班级
     * @param setTopicType 设置话题类型
     * @return 班级话题列表
     */
    @RequestMapping(contextPath + "/findClassesTopicList")
    List<Map<String, Object>> findClassesTopicList(@RequestBody Map<String, Object> classesTopic,
                                                   @RequestParam(value = "count", required = false) Integer count,
                                                   @RequestParam(value = "order", required = false) Integer order,
                                                   @RequestParam("setCreator") boolean setCreator,
                                                   @RequestParam("setClasses") boolean setClasses,
                                                   @RequestParam("setTopicType") boolean setTopicType);

    /**
     * 查询班级话题列表
     *
     * @param classesTopic 班级话题查询条件
     * @param currentPage  当前页
     * @param pageSize     每页数据量
     * @param order        排序 1.最新 2.最热
     * @param setCreator   设置创建人
     * @param setClasses   设置班级
     * @param setTopicType 设置作业类型
     * @return 班级话题列表
     */
    @RequestMapping(contextPath + "/findClassesTopicListPage")
    Map<String, Object> findClassesTopicListPage(@RequestBody Map<String, Object> classesTopic,
                                                 @RequestParam("currentPage") int currentPage,
                                                 @RequestParam(value = "pageSize", required = false) Integer pageSize,
                                                 @RequestParam(value = "order", required = false) Integer order,
                                                 @RequestParam("setCreator") boolean setCreator,
                                                 @RequestParam("setClasses") boolean setClasses,
                                                 @RequestParam("setTopicType") boolean setTopicType);

    /**
     * 查询班级话题列表
     *
     * @param userId       前台用户id
     * @param currentPage  当前页
     * @param pageSize     每页数据量
     * @param which        1.全部话题 2.发表的话题 3.参与的话题
     * @param setCreator   设置创建人
     * @param setClasses   设置班级
     * @param setTopicType 设置话题类型
     * @return 班级话题列表
     */
    @RequestMapping(contextPath + "/findClassesPersonalTopicPage")
    Map<String, Object> findClassesPersonalTopicPage(@RequestParam("userId") BigDecimal userId,
                                                     @RequestParam("currentPage") int currentPage,
                                                     @RequestParam(value = "pageSize", required = false) Integer pageSize,
                                                     @RequestParam(value = "which", required = false) Integer which,
                                                     @RequestParam("setCreator") boolean setCreator,
                                                     @RequestParam("setClasses") boolean setClasses,
                                                     @RequestParam("setTopicType") boolean setTopicType);

    /**
     * 保存班级话题
     *
     * @param classesTopic 班级话题
     * @param classesIds   班级id
     * @return 保存结果
     */
    @RequestMapping(contextPath + "/saveClassesTopic")
    Map<String, Object> saveClassesTopic(@RequestBody Map<String, Object> classesTopic,
                                         @RequestParam("classesIds") String classesIds);

    /**
     * 更新班级话题置顶
     *
     * @param ids 班级话题ids
     * @param top 置顶 1.是 2.否
     * @return 操作结果
     */
    @RequestMapping(contextPath + "/updateClassesTopicTop")
    Map<String, Object> updateClassesTopicTop(@RequestParam("ids") String ids,
                                              @RequestParam("top") int top);

    /**
     * 更新班级话题状态
     *
     * @param ids    班级话题ids
     * @param status 班级话题状态 0.未发布 1.已发布 2.已禁用 3.已删除
     * @return 操作结果
     */
    @RequestMapping(contextPath + "/updateClassesTopicStatus")
    Map<String, Object> updateClassesTopicStatus(@RequestParam("ids") String ids,
                                                 @RequestParam("status") int status);

    /**
     * 班级话题分类数据
     *
     * @return 话题分类数据
     */
    @RequestMapping(contextPath + "/classesTopicClassify")
    Map<Integer, Object> classesTopicClassify();

    /**
     * 查询话题数量
     * @param classesTopic 查询条件
     * @return  BigDecimal
     */
    @RequestMapping(contextPath + "/getClassTopicCount")
    BigDecimal getClassTopicCount(@RequestBody Map<String, Object> classesTopic);
}
